package com.atguigu.spring.controller;

import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class Demo04ControllerOriginal {

    @Autowired
    private ServletContext servletContext;

    @ResponseBody
    @RequestMapping("/receive/Original/Object")
    public String receiveOriginalObject(
            HttpServletRequest request,
            HttpServletResponse response,
            HttpSession session) {

        System.out.println("request = " + request);
        System.out.println("response = " + response);
        System.out.println("session = " + session);

        ServletContext servletContext = session.getServletContext();
        System.out.println("servletContext = " + servletContext);
        System.out.println("this.servletContext = " + this.servletContext);

        return "ok";
    }

}
